package web.hibernate;

import javax.persistence.*;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:14:57 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "diseases")
public class DiseasesEntity {
  private long disId;

  @Basic
  @Column(name = "dis_id", nullable = false, length = 10)
  public long getDisId() {
    return disId;
  }

  public void setDisId(long disId) {
    this.disId = disId;
  }

  private char[] disCode;

  @Id
  @Column(name = "dis_code", nullable = false, length = 10)
  public char[] getDisCode() {
    return disCode;
  }

  public void setDisCode(char[] disCode) {
    this.disCode = disCode;
  }

  private char[] disName;

  @Basic
  @Column(name = "dis_name", nullable = false, length = 500)
  public char[] getDisName() {
    return disName;
  }

  public void setDisName(char[] disName) {
    this.disName = disName;
  }

  private long blockId;

  @Basic
  @Column(name = "block_id", nullable = false, length = 10)
  public long getBlockId() {
    return blockId;
  }

  public void setBlockId(long blockId) {
    this.blockId = blockId;
  }

  private char[] blockName;

  @Basic
  @Column(name = "block_name", nullable = false, length = 500)
  public char[] getBlockName() {
    return blockName;
  }

  public void setBlockName(char[] blockName) {
    this.blockName = blockName;
  }

  private long classId;

  @Basic
  @Column(name = "class_id", nullable = false, length = 10)
  public long getClassId() {
    return classId;
  }

  public void setClassId(long classId) {
    this.classId = classId;
  }

  private char[] className;

  @Basic
  @Column(name = "class_name", nullable = false, length = 500)
  public char[] getClassName() {
    return className;
  }

  public void setClassName(char[] className) {
    this.className = className;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    DiseasesEntity that = (DiseasesEntity) o;

    if (blockId != that.blockId) return false;
    if (classId != that.classId) return false;
    if (disId != that.disId) return false;
    if (!Arrays.equals(blockName, that.blockName)) return false;
    if (!Arrays.equals(className, that.className)) return false;
    if (!Arrays.equals(disCode, that.disCode)) return false;
    if (!Arrays.equals(disName, that.disName)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = (int) (disId ^ (disId >>> 32));
    result = 31 * result + (disCode != null ? Arrays.hashCode(disCode) : 0);
    result = 31 * result + (disName != null ? Arrays.hashCode(disName) : 0);
    result = 31 * result + (int) (blockId ^ (blockId >>> 32));
    result = 31 * result + (blockName != null ? Arrays.hashCode(blockName) : 0);
    result = 31 * result + (int) (classId ^ (classId >>> 32));
    result = 31 * result + (className != null ? Arrays.hashCode(className) : 0);
    return result;
  }
}
